yum安装mongodb

原文地址 http://www.cnblogs.com/zhengqun/p/5038072.html

yum安装mongodb

 

ps:现在最新版已经3.2了,但是数据库是别人搭建的,用的是2.6

下面我们在CentOS 6.5 x64系统上安装MongoDB 2.6.0版。

但在MongoDB v2.6.0版的软件仓库一共有五个包:

1)mongodb-org
此包是元数据包,它可以实现自动安装下面的4个组件包。
2)mongodb-org-server
此包里面有mongod守护程序,以及相关的配置和初始化脚本。
3)mongodb-org-mongos
此包里面有mongos守护程序。
4)mongodb-org-shell
此包里面有mongo shell环境。
5)mongodb-org-tools
此包里面有以下的MongoDB工具:mongoimport、bsondump、mongodump、mongoexport、mongofiles、mongoimport、mongooplog、mongoperf、mongorestore、mongostat以及mongotop。

控制脚本:mongodb-org包里面有各种控制脚本,包括初始化脚本/etc/rc.d/init.d/mongod
使用/etc/mongod.conf配置文件来对MongoDB进行配置。

MongoDB 2.6.0版不再有mongos的控制脚本。mongos进程只用于分片的场景。你可以使用mongod初始化脚本来驱动mongos控制脚本。

要安装最新的64位MongoDB 2.6.0版,步骤如下:

1、创建mongodb.repo文件

在/etc/yum.repos.d/目录下创建文件mongodb.repo,它包含MongoDB仓库的配置信息,内容如下:

复制代码代码如下:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

 

2、执行安装命令
$ sudo yum install mongodb-org
Loaded plugins: security
base                                                                 | 3.7 kB     00:00     
base/primary_db                                                      | 4.4 MB     00:01     
extras                                                               | 3.4 kB     00:00     
extras/primary_db                                                    |  19 kB     00:00     
mongodb                                                              |  951 B     00:00     
mongodb/primary                                                      |  24 kB     00:16     
mongodb                                                                             155/155
openlogic                                                            | 1.3 kB     00:00     
openlogic/primary                                                    | 273 kB     00:00     
openlogic                                                                             24/24
updates                                                              | 3.4 kB     00:00     
updates/primary_db                                                   | 2.6 MB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:2.6.0-1 will be installed
--> Processing Dependency: mongodb-org-tools = 2.6.0 for package: mongodb-org-2.6.0-1.x86_64
--> Processing Dependency: mongodb-org-shell = 2.6.0 for package: mongodb-org-2.6.0-1.x86_64
--> Processing Dependency: mongodb-org-server = 2.6.0 for package: mongodb-org-2.6.0-1.x86_64
--> Processing Dependency: mongodb-org-mongos = 2.6.0 for package: mongodb-org-2.6.0-1.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:2.6.0-1 will be installed
---> Package mongodb-org-server.x86_64 0:2.6.0-1 will be installed
---> Package mongodb-org-shell.x86_64 0:2.6.0-1 will be installed
---> Package mongodb-org-tools.x86_64 0:2.6.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package                      Arch             Version              Repository         Size
============================================================================================
Installing:
 mongodb-org                  x86_64           2.6.0-1              mongodb           4.6 k
Installing for dependencies:
 mongodb-org-mongos           x86_64           2.6.0-1              mongodb           6.8 M
 mongodb-org-server           x86_64           2.6.0-1              mongodb           8.9 M
 mongodb-org-shell            x86_64           2.6.0-1              mongodb           4.2 M
 mongodb-org-tools            x86_64           2.6.0-1              mongodb            88 M

Transaction Summary
============================================================================================
Install       5 Package(s)

Total download size: 108 M
Installed size: 274 M
Is this ok [y/N]: y
……

posted @ 2016-03-25 16:32  但用此心  阅读(12700)  评论(0编辑  收藏  举报